package com.ctrl.riveradministrator.mvp.presenter;

import com.ctrl.riveradministrator.base.BaseObserver;
import com.ctrl.riveradministrator.base.BasePresenter;
import com.ctrl.riveradministrator.mvp.model.Contact;
import com.ctrl.riveradministrator.mvp.model.Login;
import com.ctrl.riveradministrator.mvp.view.activity.contact.ContactView;
import com.ctrl.riveradministrator.mvp.view.activity.login.LoginView;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


public class ContactPresenter extends BasePresenter<ContactView> {

    public ContactPresenter(ContactView baseView) {
        super(baseView);
    }


    public void getContact(String pageNumb, String pageSize) {
        Map<String, String> map = new HashMap<>();
        map.put("pageNumb", pageNumb);
        map.put("pageSize", pageSize);
        attachView(apiService.getContact(map), new BaseObserver<Contact>(getBaseView()) {

            @Override
            public void onSuccess(Contact model) {
                //Log.d("LoginPresenter", "onSuccess: ");

            }

            @Override
            public void onSuccess(List<Contact> model) {
                getBaseView().onSuccess(model);
            }

            @Override
            public void onFailed(String msg) {
                getBaseView().onFailed(msg);
            }

        });
    }
}
